﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditAdjustCredit.aspx.cs"
    Inherits="Skyworth.CRM.Web.SalesManagement.EditAdjustCredit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>信用额度调整信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />

    <script src="../javascripts/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../javascripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

    <script src="../javascripts/jquery.autocomplete.js" type="text/javascript"></script>

    <link href="../themes/default/style.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/core.css" rel="stylesheet" type="text/css" />
    <link href="../themes/css/pages.css" rel="stylesheet" type="text/css" />
    <link href="../javascripts/My97DatePicker/skin/WdatePicker.css" rel="stylesheet"
        type="text/css" />

    <script src="../javascripts/json2.js" type="text/javascript"></script>

    <script src="../javascripts/MessageBox.js" type="text/javascript"></script>

    <link href="../themes/css/Messagebox.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        a
        {
            display: block;
        }
        .red
        {
            color: Red;
            font-weight: bold;
        }
        table
        {
            border-collapse: collapse;
            border-spacing: 0;
            table-layout: fixed;
            width: 100%;
            border: solid 1px #e7e7e7;
        }
        table tr td
        {
            border-bottom: solid 1px #e7e7e7;
            padding: 0px 3px;
            background-color: #EFEFEF;
        }
        td label
        {
            padding: 2px 2px;
        }
        td.left
        {
            border-right: solid 1px #e7e7e7;
            width: 65px;
        }
        td.right
        {
            background: #FFF;
        }
        td.right, td.readOnly
        {
            padding: 5px 3px;
        }
        .content
        {
            overflow: auto;
            border: solid 1px #CCC;
            line-height: 21px;
            background: #FFF;
            padding: 5px;
        }
        select
        {
            width: 185px;
            height: 25px;
        }
    </style>

    <script type="text/javascript">
        function SaveCheck() {
            var objCustomerName = $("#txtCustomerName");
            var name = objCustomerName.val();
            if (name == "" || name.length <= 0) {
                alert("请输入客户名称！");
                objCustomerName.focus();
                return false;
            }

            var objFamount = $("#txtFamount");
            var famount = objFamount.val();
            if (famount == "" || famount.length <= 0) {
                alert("请输入授信金额！");
                objFamount.focus();
                return false;
            }
            if (!new RegExp(/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/).test(famount)) {
                alert("请输入正确的授信金额，授信金额必须是数字型！");
                objFamount.focus();
                return false;
            }

            var objStartDate = $("#txtStartDate");
            var startTime = objStartDate.val();
            if (startTime == "" || startTime.length <= 0) {
                alert("请输入开始日期！");
                objStartDate.focus();
                return false;
            }
            var objEndDate = $("#txtEndDate");
            var endTime = objEndDate.val();
            if (endTime == "" || endTime.length <= 0) {
                alert("请输入结束日期！");
                objEndDate.focus();
                return false;
            }

            var objtxtFYearAmount = $("#txtFYearAmount");
            var strfyearamount = objtxtFYearAmount.val();
            if (!new RegExp(/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/).test(strfyearamount)) {
                alert("请输入正确的年回款，年回款必须是数字型！");
                objtxtFYearAmount.focus();
                return false;
            }

        }

       

        $(document).ready(function() {
            $("input[type=text],textarea").addClass("textInput").width(180).focus(function() { $(this).addClass("focus"); }).blur(function() { $(this).removeClass("focus") });
            $("#btnClose").click(function() {
                parent.addWindow.close();
            })
            $("#btnSave").click(function() {
                return SaveCheck();
            })

            $("#txtCustomerName").autocomplete("../Service/CustomerHandler.ashx", {
                minChars: 1,
                autoFill: false,
                scroll: false,
                mustMatch: true,
                selectFirst: true,
                formatItem: function(result, i, max) {
                    var item = "<span>" + result[1] + "</span>"
                    return item;
                },
                formatMatch: function(row, i, max) {
                    return row[0] + " " + row[1];
                },
                formatResult: function(row) {
                    return row[1];
                }
            });
            $("#txtCustomerName").result(function(event, data, formatted) {
                if (data && data.length > 0) {
                    $("#txtAddress").val(data[2]);
                    $("#txtMobil").val(data[3]);
                }
            });

        })

        function f_selectcust() {
            //window.showModalDialog('CustomerInfo.aspx', 'example04', 'dialogWidth:800px;dialogHeight:450px;dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes');
            //return false;
            window.open("CustomerInfo.aspx", "newwindow", "height=400,width=680,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no"); 
        }
        
    </script>

</head>
<body style="text-align: left; background-color: White;">
    <form id="form1" runat="server">
    <div>
        <div style="margin: 2px;">
            <div class="panel">
                <div class="panelHeader">
                    <div class="panelHeaderContent">
                        <h1>
                            信用额度调整信息</h1>
                    </div>
                </div>
                <div class="panelContent">
                    <div class="content">
                        <table width="100%">
                            <tr>
                                <td class="left">
                                    <label for="ddlFCreditType">
                                        信用类别：</label>
                                </td>
                                <td class="right">
                                    <asp:DropDownList ID="ddlFCreditType" runat="server">
                                        <asp:ListItem Value="1">销售信用</asp:ListItem>
                                        <asp:ListItem Value="2">财务信用</asp:ListItem>
                                        <asp:ListItem Value="3">业务员信用</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td class="left">
                                    <label for="txtCustomerName">
                                        客户名称：</label>
                                </td>
                                <td class="right">
                                    <div>
                                        <asp:TextBox ID="txtCustomerName" runat="server" MaxLength="50" title="请输入客户名称!"></asp:TextBox>
                                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/themes/default/images/button/query.gif"
                                            Width="22px" Height="20px" OnClientClick="f_selectcust()" />
                                        <em class="red">*</em>
                                </td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <label for="txtAddress">
                                        客户地址：</label>
                                </td>
                                <td class="right">
                                    <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
                                </td>
                                <td class="left">
                                    <label for="txtCustId">
                                        客户手机：</label>
                                </td>
                                <td class="right">
                                    <asp:TextBox ID="txtMobil" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <label for="ddlFtype">
                                        授信类型：</label>
                                </td>
                                <td class="right">
                                    <asp:DropDownList ID="ddlFtype" runat="server">
                                        <asp:ListItem Value="1">追加信用额度</asp:ListItem>
                                        <asp:ListItem Value="2">扣减信用额度</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td class="left">
                                    <label for="txtFamount">
                                        授信金额：</label>
                                </td>
                                <td class="right">
                                    <asp:TextBox ID="txtFamount" runat="server" MaxLength="50" title="请输入授信金额!"></asp:TextBox>
                                    <em class="red">*</em>
                                </td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <label for="txtStartDate">
                                        开始日期：</label>
                                </td>
                                <td class="right">
                                    <asp:TextBox ID="txtStartDate" runat="server" onClick="WdatePicker({skin:'ext',maxDate:'#F{$dp.$D(\'txtEndDate\')}'})"></asp:TextBox><em
                                        class="red">*</em>
                                </td>
                                <td class="left">
                                    <label for="txtEndDate">
                                        结束日期：</label>
                                </td>
                                <td class="right">
                                    <asp:TextBox ID="txtEndDate" runat="server" onClick="WdatePicker({skin:'ext',minDate:'#F{$dp.$D(\'txtStartDate\')}'})"></asp:TextBox><em
                                        class="red">*</em>
                                </td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <label for="ddlFCreditWay">
                                        授信方式：</label>
                                </td>
                                <td class="right">
                                    <asp:DropDownList ID="ddlFCreditWay" runat="server">
                                        <asp:ListItem Value="1">按比率授信</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td class="left">
                                    <label for="txtFYearAmount">
                                        年回款：</label>
                                </td>
                                <td class="right">
                                    <asp:TextBox ID="txtFYearAmount" runat="server" MaxLength="50"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <label for="ddlFisYes">
                                        是否生效：</label>
                                </td>
                                <td class="right" colspan="3">
                                    <asp:DropDownList ID="ddlFisYes" runat="server">
                                        <asp:ListItem Value="1">生效</asp:ListItem>
                                        <asp:ListItem Value="0">不生效</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" class="readOnly" style="padding-right: 12px; background: url('../themes/default/images/grid/grid.png') repeat scroll 0 0">
                                    <a title="清空" href="javascript:void(0)" class="button" style="float: left" id="btnClose">
                                        <span>关闭</span></a>
                                    <div class="button" style="float: right; margin-right: 5px;">
                                        <div class="buttonContent">
                                            <asp:Button ID="btnSave" runat="server" Text="保存" CssClass="serverButton" OnClick="btnSave_Click" />
                                        </div>
                                    </div>
                                    <div style="clear: both; float: none; display: none;">
                                        <input type="hidden" style="display: none;" id="selectedEmpID" runat="server" />
                                        <input type="hidden" id="hidecustid" runat="server" />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="panelFooter">
                    <div class="panelFooterContent">
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
